package com.yl.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yl.auth.entity.HugongfuwuBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author 王帅洋
 * @datetime 2023/6/17 11:10
 * @description 类对象
 */
public interface HugongfuwuMapper extends BaseMapper<HugongfuwuBean> {
    @Update("update hugongfuwu set jifen=#{hugongfuwuBean.jifen}")
    void updateJiFen(@Param("hugongfuwuBean") HugongfuwuBean hugongfuwuBean);

    @Insert("insert into jifen_renminbi(mid,jifen) VALUES(#{hugongfuwuBean.id},#{hugongfuwuBean.jifens})")
    void updateByHid(@Param("hugongfuwuBean") HugongfuwuBean hugongfuwuBean);

    @Select("SELECT a.*,b.jifen jifens from hugongfuwu a LEFT JOIN jifen_renminbi b on a.id=b.mid GROUP BY id")
    List<HugongfuwuBean> getAll();

    List<HugongfuwuBean> findfuwuList(@Param("hugongfuwuBean") HugongfuwuBean hugongfuwuBean);

    List<HugongfuwuBean> findzhongdList(@Param("hugongfuwuBean") HugongfuwuBean hugongfuwuBean);

    List<HugongfuwuBean> findzhongduuList(@Param("hugongfuwuBean") HugongfuwuBean hugongfuwuBean);
    List<HugongfuwuBean> fuwuList(@Param("id1") Long id1,@Param("id2")Long id2);

    List<HugongfuwuBean> getxiangmuall(@Param("id1")Long id1,@Param("id2")Long id2);
    @Insert("insert into xiangmu_dengji(fuwu_id,dengji_id,xiangmu_id)\n" +
            "values(#{id},#{id2},#{id1})")
    void savefuwu(@Param("id")Integer id,@Param("id1")Long id1,@Param("id2")Long id2);
    @Delete("delete from xiangmu_dengji where fuwu_id=#{id} and dengji_id=#{id2} and xiangmu_id=#{id1}")
    void removeDataById(@Param("id") Integer id,@Param("id1")Long id1,@Param("id2")Long id2);


}
